package top.toptimus.dto.wip;

import lombok.Data;
import lombok.NoArgsConstructor;
import top.toptimus.dto.order.orderSync.orderCommit.OrderCommitDto;

import java.util.Date;

/**
 * 项目实例
 */
@NoArgsConstructor
@Data
public class WipStatusDTO {
    private String id;
    private String batchNo; //  生产批次
    private String orderId; //  订单id
    //  WBS模板信息
    private String wbsTemplateId;   //  WBS模板id
    private String wbsItemId;  //  WBS项目id
    private String parentId;    //  父id
    private String activityDescription; //  工作描述
    private String code;  //  WBS编码顺序
    private int index;   //  顺序
    //  WBS实例信息
    private Date actualFinishDate;  //  实际完成时间
    private Date startTimePlanned;  //  计划开始时间（工单时间）
    private double duration;    //  工期
    private double costPlusFixedFee;   //  成本加固定费用
    private String responsorId;  //  任务负责人ID
    private String responsor;    //  任务负责人
    private String content; //  内容
    private boolean done = false;   //  完成标识

    //  附加信息
    private String orderNo;//  订单号
    private Double batchQuantity; //批次数量
    private String customerId;
    private String customerName;
    private String mobile;
    private String shopId;
    private String shopName;
    private String materialNameCn;//面料描述名称
    private String materialCode; //面料号
    private String styleNameCn;//款式名称
    private String styleSizeCd;//尺码
    private String refStyleId; //  标准款id
    private Date orderDate;//订单时间
    private String styleCategoryCd; //  服装类别

    private boolean urgentFlg;  //  加急标识

    public WipStatusDTO(
            String id,
            String batchNo,
            String orderId,
            String wbsTemplateId,
            String wbsItemId,
            String parentId,
            String activityDescription,
            String code,
            int index,
            Date actualFinishDate,
            Date startTimePlanned,
            double duration,
            double costPlusFixedFee,
            String responsorId,
            String responsor,
            String content,
            boolean done
    ) {
        this.id = id;
        this.batchNo = batchNo;
        this.orderId = orderId;
        this.wbsTemplateId = wbsTemplateId;
        this.wbsItemId = wbsItemId;
        this.parentId = parentId;
        this.activityDescription = activityDescription;
        this.code = code;
        this.index = index;
        this.actualFinishDate = actualFinishDate;
        this.startTimePlanned = startTimePlanned;
        this.duration = duration;
        this.costPlusFixedFee = costPlusFixedFee;
        this.responsorId = responsorId;
        this.responsor = responsor;
        this.content = content;
        this.done = done;
    }

    public WipStatusDTO build(OrderCommitDto orderCommitDto) {
        this.orderNo = orderCommitDto.getOrderNo();
        this.customerId = orderCommitDto.getCustomerId();
        this.customerName = orderCommitDto.getCustomerName();
        this.mobile = orderCommitDto.getMobile();
        this.shopId = orderCommitDto.getShopId();
        this.shopName = orderCommitDto.getShopName();
        this.materialNameCn = orderCommitDto.getMaterialNameCn();
        this.materialCode = orderCommitDto.getMaterialCode();
        this.styleNameCn = orderCommitDto.getStyleNameCn();
        this.styleSizeCd = orderCommitDto.getStyleSizeCd();
        this.refStyleId = orderCommitDto.getRefStyleId();
        this.orderDate = orderCommitDto.getOrderDate();
        this.styleCategoryCd = orderCommitDto.getStyleCategoryCd();
        return this;
    }

    public void build(boolean urgentFlg, Double batchQuantiry) {
        this.urgentFlg = urgentFlg;
        this.batchQuantity = batchQuantiry;
    }
}
